#include <QRegExpValidator>
#include "luminance.h"
#include "ui_luminance.h"
#include "Image.h"
extern Image photo;

Luminance::Luminance(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Luminance)
{
    ui->setupUi(this);
    setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
    ui->lineEdit->setValidator(new QRegExpValidator(QRegExp("1?[0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5]")));
}

Luminance::~Luminance()
{
    delete ui;
}

void Luminance::on_horizontalSlider_sliderMoved(int position)
{
    QString num=QString("%1").arg(position);
    ui->lineEdit->setText(num);
}

void Luminance::on_pushButton_2_clicked()
{
    this->close();
}

void Luminance::on_pushButton_clicked()
{
    sendData(ui->lineEdit->text().toInt());
    this->close();
}


void Luminance::on_horizontalSlider_valueChanged(int value)
{
    QString num=QString("%1").arg(value);
    ui->lineEdit->setText(num);
}
